package com.hiwan.unions.adapter.fragmentAdapters;

import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.ArrayList;

/**
 * Created by llg on 2017/7/8.
 */
public class MyFragmentPagerAdapter extends FragmentPagerAdapter {
    private String[] titles;
    private ArrayList<Fragment> listFragments;

    public MyFragmentPagerAdapter(FragmentManager fm, Context context, String[] titles, ArrayList<Fragment> listFragments) {
        super(fm);
        this.titles = titles;
        this.listFragments = listFragments;
    }

    @Override
    public Fragment getItem(int position) {
        return listFragments.get(position);
    }

    @Override
    public int getCount() {
        return listFragments.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return titles[position];
    }
}